"""
@Project: pythonPro1
@Name: _03boundary_fill.py
@Author: linxin_liu
@Date: 2022/10/12 14:49
边界填充、
replicate: 复制
"""
import cv2
from _00tools import cv_show

img = cv2.imread('D:/tools/image_operation/cat.png')
top_size, bottom_size, left_size, right_size = (100, 100, 100, 100)  # 边界填充的大小，以不同的方式填充。
img0 = cv2.copyMakeBorder(img, top_size, bottom_size, left_size, right_size, borderType=cv2.BORDER_REPLICATE)  # 复制
cv_show('img0', img0, 3000)
img1 = cv2.copyMakeBorder(img, top_size, bottom_size, left_size, right_size, cv2.BORDER_REFLECT)  # 反射
cv_show('img1', img1, 3000)
img2 = cv2.copyMakeBorder(img, top_size, bottom_size, left_size, right_size, cv2.BORDER_REFLECT_101)  # 反射101
cv_show('img2', img2, 3000)
img3 = cv2.copyMakeBorder(img, top_size, bottom_size, left_size, right_size, cv2.BORDER_WRAP)  # 包裹
cv_show('img3', img3, 3000)
img4 = cv2.copyMakeBorder(img, top_size, bottom_size, left_size, right_size, cv2.BORDER_CONSTANT, value=0)  # 固定值
cv_show('img4', img4, 3000)
